#e
#Title[u̊فv]
#Text[]
#ScriptVersion[2]
script_enemy_main
{
	let cx=GetCenterX();//STGV[̒SxW擾
	let cy=GetCenterY();//STGV[̒SyW擾
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetScore(30000);
		SetLife(1);
		SetDamageRate(0,0);
		SetMovePosition02(cx,cy-120,60);
		SetTimer(93);
		SetGraphicRect(1,1,64,64);
		SetDurableSpellCard;
		LoadGraphic(imgExRumia);
		SetTexture(imgExRumia);	
		shottask;
		shottask2;
		movetask;
		CutIn(YOUMU,"u̊فv",0,0,0,0,0);//XyJ[h\
	}
	@MainLoop
	{
		yield;
	}
	@Finalize
	{//ǂ݂񂾃t@C폜
		loop(8)
		{
			CreateItem(ITEM_SCORE,cx+rand(-100,100),rand(20,100));
		}
	}
	
	@DrawLoop
	{
		//Ex[~A`
		SetGraphicRect(64,64,127,127);
		SetAlpha(0);
		SetTexture(imgExRumia);
		DrawGraphic(GetX(),GetY());
	}
	task shottask
	{
		let s=0;
		loop
		{
			wait(3);
			if(GetTimer<=87)
			{
				shot2(s,120,0,30,1);
			}
			if(GetTimer<=70)
			{
				shot2(s,120,180,30,1);
				shot2(s,120,90,30,1);
				shot2(s,120,-90,30,1);
			}
			if(GetTimer<=55)
			{
				shot2(s,120,rand(-90,90),126,1);
			}
		}
	}
	task shottask2
	{
		let s=0;
		loop
		{
			wait(12);
			if(GetTimer<=30)
			{
				shot2(s,120,0,38,0.4);
			}
			if(GetTimer<=15)
			{
				shot2(s,120,0,102,4);
			}
		}
	}	
	task movetask
	{
		loop
		{
			yield;
			if(GetTimer<=86)
			{
				SetMovePosition02(GetPlayerX,GetPlayerY,30);
			}
			if(GetTimer==71)
			{
				Concentration01(60);
				wait(60);
			}
			if(GetTimer==56)
			{
				Concentration01(60);
				wait(60);
			}
			if(GetTimer==31)
			{
				Concentration01(60);
				wait(60);
			}
			if(GetTimer==16)
			{
				Concentration01(60);
				wait(60);
			}
		}
	}
	function shot(let shotid,let shott,let angle,let tipe,let sp)
	{
		CreateShotA(shotid,GetX,GetY,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(shotid,0,sp,angle,0,0,2,tipe);
		FireShot(shotid);
	}
	function shot2(let shotid,let shott,let angle,let tipe,let sp)
	{
		CreateShotA(shotid,GetX,GetY,10);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(shotid,0,0,GetAngleToPlayer,0,0,2,tipe);
		SetShotDirectionType(PLAYER);
		SetShotDataA(shotid,shott,sp,angle,0,0,2,tipe);
		FireShot(shotid);
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}